# @rspress/plugin-last-updated <SourceCode href="https://github.com/web-infra-dev/rspress/tree/main/packages/plugin-last-updated" />

import { SourceCode, PackageManagerTabs } from '@rspress/core/theme';

## Introduction

`@rspress/plugin-last-updated` is a plugin for displaying the last updated time in articles.

:::tip

- When you have configured `lastUpdated: true` in the default theme, this plugin will be automatically activated. You don't need to install and register it manually.
- You need to commit the markdown file to see the updated time.

:::

## Installation

<PackageManagerTabs command="add @rspress/plugin-last-updated -D" />

## Usage

### 1. Register the plugin

```ts title="rspress.config.ts"
import { pluginLastUpdated } from '@rspress/plugin-last-updated';
import { defineConfig } from '@rspress/core';

export default defineConfig({
  plugins: [pluginLastUpdated()],
});
```

### 2. Access at runtime

After registering the plugin, you can get the last updated timestamp of the article at runtime. Here's an example:

```ts
import { usePageData } from '@rspress/core/runtime';

function MyComponent() {
  const pageData = usePageData();
  return <div>{pageData.page.lastUpdatedTime}</div>;
}
```
